#!/usr/bin/perl -w

@array = <>;
foreach (@array) {
if (( /fred \w* wilma/|/wilma \w* fred/)) {
   print "$_";
   }
}
